import com.qr.pojo.Buy;
import com.qr.pojo.Loan;
import com.qr.pojo.User;
import com.qr.service.BuyService;
import com.qr.service.LoanService;
import com.qr.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test2 {
    @Test
    public void test(){
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userServiceImpl = (UserService) context.getBean("userServiceImpl");
        for (User user : userServiceImpl.AllUser() ){
            System.out.println(user);

        }
    }
    @Test
    public void tset3(){
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userServiceImpl = (UserService) context.getBean("userServiceImpl");
        User user= userServiceImpl.findUserByName("2019113208");
            System.out.println(user);


    }
    @Test
    public void test4(){
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
        BuyService buyServiceImpl = (BuyService) context.getBean("buyServiceImpl");
        for (Buy buy : buyServiceImpl.AllBuy() ){
            System.out.println(buy);

        }

    }
    @Test
    public void test5(){
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
        LoanService loanServiceImpl = (LoanService) context.getBean("loanServiceImpl");
        for (Loan loan : loanServiceImpl.findAll() ){
            System.out.println (loan);

        }
    }

}
